home *** CD-ROM | disk | FTP | other *** search
- Path: news.compuserve.com!newsmaster
- From: 76623,2065@compuserve.com (Bobby Martin)
- Newsgroups: comp.lang.c++
- Subject: Re: Question about destructor...
- Date: 4 Jan 1996 14:42:02 GMT
- Organization: CompuServe Incorporated
- Message-ID: <4cgovq$oqo@dub-news-svc-4.compuserve.com>
- References: <4cegke$p5@newsbf02.news.aol.com> <4ces35$3iq$1@mhafn.production.compuserve.com>
- Reply-To: 76623,2065@compuserve.com (Bobby Martin)
- NNTP-Posting-Host: ad42-148.compuserve.com
- X-Newsreader: IBM NewsReader/2 v1.03
-
- In <4ces35$3iq$1@mhafn.production.compuserve.com>, Nil Bannerjee <100704.1417@CompuServe.COM> writes:
- > If you call the destructor of A from B's destructor then this
- >will take care of the inherited attributes.
- >
- >CB::~CB()
- >{
- > //your stuff..
- > ..
- > ..
- > ~CA();
- >}
- Um, that's a bad idea. The destructor for the base class (~CA) is called
- automatically after the child's destructor (~CB) completes, and should take care
- of the inherited private data object deletion (if the parent class was written and
- is being used properly). You shouldn't ever need to explicitely call the parent's
- destructor.
-